<%@page import="pro.syj.dao.StudentDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>学生注册处理</title>
	<link rel='stylesheet' href='CSS/decorator1.css'>
</head>

<body>
	 <%
        // 设置获取注册时的编码为UTF-8
        request.setCharacterEncoding("UTF-8");
		StudentDao studentdao = new StudentDao();
	 
	 	//获取studentRegist.jsp页面提交的信息
        String sid = request.getParameter("sid");
        String psd = request.getParameter("psd");
        String sname = request.getParameter("sname");
        String grade = request.getParameter("grade");
        String major = request.getParameter("major");

        //引入数据交互层
        int flag = studentdao.addStudent(sid, psd, sname, Integer.parseInt(grade), major); 

        if(flag == 1){
            response.sendRedirect("index.jsp");
        }else{
            response.sendRedirect("error.jsp");
        }
    %>
</body>
</html>